<?php

namespace app\api\model\coupon;

use app\logic\model\coupon\CouponLogicModel;
use app\logic\model\music\MusicLogicModel;
use app\logic\model\user\UserLogicModel;

class CouponApiModel extends CouponLogicModel
{
    public function getApiList(array $param, string $field='*', $page=1, $limit=15,string $order='sort desc')
    {
        $query=$this
            ->where(function ($q) use ($param){
                if(check_request($param,'status')){
                    $q->where('status',$param['status']);
                }
            });
        $list = $query->field($field)->order($order)
            ->page($page,$limit)->select();
        $count = $query->count();
        return [$list,$count];
    }
}